import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Home-pc
 * Date: 2023-08-18
 * Time: 13:51
 */
public class Test22 {
    String str=new String("good");
    char[] ch={'a','b','c'};

    public static void main(String[] args) {
        Test22 ex=new Test22();
        ex.change(ex.str,ex.ch);
        System.out.println(ex.str);
        System.out.println(ex.ch);
    }
    public void change(String str,char ch[]){
        str="test ok";
        ch[0]='g';
    }
}

class SystemUtil {
    public static boolean isAdmin(String userId) {
        return userId.toLowerCase() == "admin";
    }

    public static void main(String[] args) {
        StringBuilder sb1=new StringBuilder("hello");
        sb1.append("world");
        System.out.println(sb1);
        System.out.println(sb1.insert(2, "wowo"));
        System.out.println(sb1.delete(5, 7));
        System.out.println(sb1.reverse());
        System.out.println(sb1.toString());

    }
}

 class Main {
     public static int getElement(int[] array, int index){
            if(null == array){
                throw new NullPointerException("传递的数组为null");}
                if(index < 0 || index >= array.length){
                    throw new ArrayIndexOutOfBoundsException("传递的数组下标越界");}
                return array[index];
     }
    public static void main(String[] args) {
        int[] array1 = {1,2,3};
       getElement(array1, 3);
        }

}


/*class Person {
    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
 class Test23{
    public static void main(String[] args) throws CloneNotSupportedException {
        Person person=new Person();
        Person person1=(Person)person.clone();
    }
}*/



class Tst34{
    public static void main(String[] args) {
        System.out.println("before");
        Scanner scanner=new Scanner(System.in);
        try{
            int a=scanner.nextInt();
           // System.out.println(10/0);
            System.out.println("123456");
            int[] arr=null;
            System.out.println(arr.length);
        } catch (ArithmeticException e) {
            e.printStackTrace();
            System.out.println("我捕获到了一个ArithmeticException异常");
        }catch (NullPointerException e) {
            e.printStackTrace();
            System.out.println("我捕获到了一个NullPointerException异常");
        }finally {
            scanner.close();
            System.out.println("finally中的代码是一定会被执行的");
        }
        System.out.println("after");
    }
}



class TestFinally {
    public static int getData() {
        Scanner sc = null;
        try {
            sc = new Scanner(System.in);
            int data = sc.nextInt();
            return data;
        } catch (InputMismatchException e) {
            e.printStackTrace();
        } finally {
            System.out.println("finally中代码");
        }
        System.out.println("try-catch-finally之后代码");
        if (null != sc) {
            sc.close();
        }
        return 0;
    }
         public static void main(String[] args) {
         int data = getData();
         System.out.println(data);
         }
        }
/*    public static void main(String[] args) {
        System.out.println(func());
    }
    public static int func() {
        try {
            return 10;
        } finally {
            return 20;
        }
    }*/

class Tset45{
    public static void func(int a){
        System.out.println(10/a);
    }

    public static void main(String[] args) {
        func(0);
    }
}












